Skip to content

Implement SO4 Soroban event indexing#190

Merged
IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
0xsteins:issue-183
Jun 24, 2026
Merged

Implement SO4 Soroban event indexing#190
IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
0xsteins:issue-183

Conversation

@0xsteins

Copy link
Copy Markdown
Contributor

Summary

closes #183

  • Replace the starter transfer-only mapping with SO4 Soroban event dispatch.
  • Add ScVal decoding helpers for topics, addresses, BytesN<32>, booleans, integers, and tuple/map payloads.
  • Index SO4 market, deposit, withdrawal, order, position, liquidation, ADL, fee, referral, token, and faucet events with deterministic IDs.
  • Add defensive handling for unknown or malformed events with structured logs.
  • Add unit coverage for the main event families and document the entity ID scheme.

Verification

  • bun run --cwd apps/s03-indexer codegen
  • bun run --cwd apps/s03-indexer build
  • bun run --cwd apps/s03-indexer test

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

@0xsteins is attempting to deploy a commit to the Ijai's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@0xsteins Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@IbrahimIjai

Copy link
Copy Markdown
Contributor

Stong PR.... IMpressive!

Dispatch + upsert idempotency, deterministic IDs, structured skip-logging, contract-ID gating, and family-complete tests all hit the checklist. Two things before merge, then cleanup.

  1. Tests skip the decode layer and positional field map — exactly where the risk is. so4Event injects a ready-made named object, so dispatch/idempotency are covered, but decodeTuple/decodeAddress/decodeBytesN32/decodeInteger and every fieldString(..., ) fallback are untested — and positional is the path that actually runs for tuple events. Please add decoder tests with real xdr.ScVal fixtures, one test running a raw event through decodeSorobanEvent with named empty, and verify the indices (sizeDeltaUsd@5, pnlUsd@11, …) against the real SO4 event signatures — right now they're assumptions.
  2. namedTuple assumes Vec payloads are flat [key, value, …]. If SO4 emits positional tuples or ScMaps, that synthesizes junk named entries (masked today by the positional fallback). Confirm the real shape: ScMap is already handled; for Vec, drop the synthesis and go purely positional with documented indices.
    Cleanup:

SO4_CONTRACTS is hardcoded while a sync:contracts script exists — two sources of truth. If the literal is manual, import from the synced manifest so addresses can't drift.
Delete the leftover src/test/mappingHandlers.test.ts template stub (real tests are in tests/).

#1 and #2 before merge. Genuinely good work.

@IbrahimIjai IbrahimIjai merged commit 668dc47 into SO4-Markets:main Jun 24, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#6. Implement SO4 Soroban Event Mappings

2 participants